package leetcode

import kotlinetc.println

//https://leetcode.com/problems/longest-increasing-subsequence/

/**
Given an unsorted sort.getArray of integers, find the length of longest increasing subsequence.

Example:

Input: [10,9,2,5,3,7,101,18]
Output: 4
Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.
Note:

There may be more than one LIS combination, it is only necessary for you to return the length.
Your algorithm should run in O(n2) complexity.
Follow up: Could you improve it to O(n log n) time complexity?
 */
fun main(args: Array<String>) {

    camelCase("__AAAdamPicoMan").println()
}

fun camelCase(variableName: String): String {
    val stringBuffer = StringBuffer()

    val chars = variableName.toCharArray()

    var pos = 0

    var upperCase = false
    while (pos < chars.size) {
        val ch = chars[pos]
        if (ch !in '0'..'9' && ch != '_') {
            if (upperCase) {
                if (ch in 'A'..'Z') {
                    stringBuffer.append(ch.toLowerCase())
                } else {
                    stringBuffer.append(ch)
                }
                upperCase = false

            } else {

                if (ch in 'A'..'Z')
                    upperCase = true

                stringBuffer.append(ch)

            }

        }

        pos++


    }
    return stringBuffer.toString()
}

fun lengthOfLIS(nums: IntArray): Int {


    var res = 0

    val size = nums.size

    val dp = Array<Int>(size, { 1 })

    //以 nums[i] 结尾的 序列的长度
    val len = Array<Int>(size, { 1 })


    //以 nums[i] 结尾的序列的个数
    val cnt = Array<Int>(size, { 1 })


    for (i in 0 until size) {

        for (j in 0 until i) {

            //前一个数字比结尾的数字大，无法形成序列
            if (nums[j] > nums[i]) continue


        }


    }

    return 1
}